package main

import (
	"os"
	"path"
	"strconv"
)

const defaultDir = "/Users/xianmingliu/xsomnus/go/src/go-arch/linux/io/file/demo2"

func main() {

	file, err := os.OpenFile(path.Join(defaultDir, "demo2.txt"), os.O_APPEND|os.O_RDWR|os.O_CREATE, os.ModePerm)
	defer file.Close()
	if err != nil {
		panic(err)
	}
	for i := 0; i < 4; i++ {
		file.WriteString(strconv.Itoa(i) + "\n")
	}
}
